package com.example.apptest;

import android.os.SystemClock;

import com.example.apptest.fragment.MySurface;

public class GraphThread extends Thread{

    private MySurface surface;
    private boolean isRun;
    public GraphThread(MySurface s){
        surface = s;
    }

    public void setRun() {
        isRun = true;
    }

    public void setPause(){
        isRun = false;
    }


    @Override
    public void run() {
        //调用postInvalidate();
        while(isRun)
        {
            SystemClock.sleep(1000/50);
            surface.postInvalidate();
        }
    }
}
